<?php
require_once('merchant_fns.php');
check_merchant();
$words = $_POST['search_dishes'];
$result = get_search_dishes($words);
if ($result) {
    echo "<table border=\"1\">
        <tr>
            <th>菜品ID</th>
            <th>菜品名称</th>
            <th>菜品简介</th>
            <th>菜品价格</th>
            <th>已售数量</th>
            <th>是否推荐</th>
            <th>菜品状态</th>
            <th>操作</th>
        </tr>";
    while ($row = $result->fetch_array()) {
        echo "<tr>";
        echo "<td>{$row['did']}</td>";
        echo "<td>{$row['name']}</td>";
        echo "<td>{$row['info']}</td>";
        echo "<td>{$row['price']}</td>";
        echo "<td>{$row['qsold']}</td>";
        echo "<td>{$row['reced']}</td>";
        echo "<td>{$row['state']}</td>";
        echo "<td><a href=\"merchant_management_dishes.php?did={$row['did']}\">管理</a></td>";
        echo "</tr>";
        echo "<a href=merchant_center.php>返回上页</a>";
    }
}else{
    echo "查询失败！";
}
?>